package com.jadobo.xswing.render.impl;

import javax.swing.JFrame;

import org.springframework.context.ApplicationContext;

import com.jadobo.xswing.render.IRenderer;
import com.jadobo.xswing.spring.ApplicationContextProvider;
import com.jadobo.xswing.xhtml.parser.impl.DOMHtml;

public class SwingServiceFacade {
	
	public static void loadPage(IRenderer renderer, JFrame target, String pageName) {
		
		target.getContentPane().removeAll();
		target.getContentPane().repaint();
		
		ApplicationContext ctx = ApplicationContextProvider.getApplicationContext();
		DOMHtml page = ctx.getBean(pageName, DOMHtml.class);
		
		renderer.render(page.getPage());
		
	}

}
